/********************************************
 *    easyTooltip -> TODAS AS PÁGINAS       *
 ********************************************/

$(document).ready(function(){
        $(".tool").easyTooltip();
        $(".toolmenu").easyTooltip({
            tooltipId: "easyTooltipMenu"
        });
});


/********************************************
 *    SLIDEIN -> index - slide de imagens   *
 ********************************************/
function slidein(){
    active_img = $(".active");
    //O método next pega o próximo objeto,  dentro do div #slide-img
    next_img =active_img.next();

    // verifica se existe um próximo objeto no div #slide-img
    if (next_img.length==0){
            //se não tem um próximo objeto retorna para o primeiro
            next_img = $(".first-active");
    }

    active_img.fadeOut("slow");
    active_img.removeClass('active');

    next_img.fadeIn("slow");
    next_img.addClass('active');
}


$(document).ready(function(){
setInterval("slidein()", "10000");}
)


/**************************************************
 *    INPUT FILE -> padrao p/ todas os browsers   *
 **************************************************/

$(".inputFile > input").change(function() {
        $(this).prev().html($(this).val());
});

/**************************************************
 *    Mascaras para formularios com Maskedinput   *
 **************************************************/
$(document).ready(function(){  
    $(function(){   
        $(".telefone").mask("(99) 9999-9999");  
        $(".cep").mask("99.999-999");  
        $(".data").mask("99/99/9999");  
        $(".cpf").mask("999.999.999-99");  
        $(".cnpj").mask("99.999.999/9999-99");
        
        
        $('#salario, .monetario').priceFormat({
            prefix: 'R$ ',
            centsSeparator: ',',
            thousandsSeparator: '.'
         });
    });  
 });  

/****************************************************************
 *      Checked automático do campo pesquisa - funcionario      *
 ****************************************************************/

$(document).ready(function(){
    $("#pesquisar").keypress(function(){
      var pesq = $("#pesquisar").val();;
      if(isNaN(pesq)){
          $("input[value=codigo]").removeAttr("checked");
          $("input[value=nome]").attr("checked", "checked");
      }
      else{
          $("input[value=nome]").removeAttr("checked");          
          $("input[value=codigo]").attr("checked", "checked");

      }
   });
});

/****************************************************************
 *      Checked automático do campo pesquisa - Aluno            *
 ****************************************************************/

$(document).ready(function(){
    $("#pesquisar").keypress(function(){
      var pesq = $("#pesquisar").val();;
      if(isNaN(pesq)){
          $("input[value=matricula]").removeAttr("checked");
          $("input[value=nome]").attr("checked", "checked");
      }
      else{
          $("input[value=nome]").removeAttr("checked");          
          $("input[value=matricula]").attr("checked", "checked");

      }
   });
});

/***********************************
 * hidden automatico de mensagens  *
 ***********************************/

$(document).ready(function() {

    setTimeout("$('.msg-warning, .msg-error, .msg-success, .msg-info').fadeOut()", 3000);

});



$(document).ready(function() {
    $("#buscaAluno").hide();
    
    $.superbox.settings = {
            overlayOpacity: .8, // Background opaqueness
            boxWidth: "600", // Default width of the box
            boxHeight: "400", // Default height of the box
            loadTxt: "Carregando...", // Loading text
            closeTxt: "Fechar" // "Close" button text
    };
    $.superbox();
});



 $(function(){
   $("select[name=origem]").change(function(){
     beforeSend: $("select[name=acao]").html(" <option value='0' class='size80'>AGUARDE CARREGANDO... </option>");

     var origem = $("select[name=origem]").val();
     $.post("app/controller/aluno/matriculaController.php", {origem: origem}, function(pega_acao){
        complete:$("select[name=acao]").html(pega_acao);

     });
   });
 });